#include <bits/stdc++.h>

#define in read()
#define fi first
#define se second
#define pb push_back

using namespace std;

typedef long long ll;
typedef double db;
typedef vector < int >  vec;
typedef pair < int , int > pii;

int read() {
  int x = 0; bool f = 0; char ch = getchar(); while(!isdigit(ch)) f |= ch == '-',ch = getchar();
  while(isdigit(ch)) x = x * 10 + (ch ^ 48),ch = getchar(); return f ? -x : x;
}

const int N = 1e5 + 10;

int K[N],n;

mt19937 rnd(time(NULL));

int main() {
#ifndef ONLINE_JUDGE
    freopen("1.in","w",stdout);
#endif
    n = 3000;  printf("%d\n",n);
    for(int i = 1;i <= n;i++) K[i] = rnd() % (n - 1) + 1,printf("%d ",K[i]);
    puts("");
    for(int i = 2;i <= n;i++) {
	int u = i,v = rnd() % (i - 1) + 1;
	printf("%d %d\n",u,v);
    }
} 
